import makeRequest from "../utils/request";
// 定义数据类型
export interface Course {
    id: number;
    title: string;
    price: string;
    point: string;
    category: string;
    course_img: string;
  }
export type CourseWithoutId = Omit<Course, "id">
export async function getCourse(){
    return makeRequest<Course[]>("course")
}

export async function delcourse(id: number){
    return makeRequest<string>(
        "course",
        {
            data:{id},
            method:"DELETE"
        }
    )
}
export async function updateCourse(data:Course){
    return makeRequest<string>(
        "course",
        {
            data,
            method:"PUT"
        }
    )
}
export async function creatCourse(data:CourseWithoutId){
    return makeRequest<string>(
        "course",
        {
            data,
            method:"post"
        }
    )
}